{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #Count the Number of Vowel Strings in Range"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #array #string"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #数组 #字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: vowelStrings"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #统计范围内的元音字符串数"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "<p>给你一个下标从 <strong>0</strong> 开始的字符串数组 <code>words</code> 和两个整数：<code>left</code> 和 <code>right</code> 。</p>\n",
    "\n",
    "<p>如果字符串以元音字母开头并以元音字母结尾，那么该字符串就是一个 <strong>元音字符串</strong> ，其中元音字母是 <code>'a'</code>、<code>'e'</code>、<code>'i'</code>、<code>'o'</code>、<code>'u'</code> 。</p>\n",
    "\n",
    "<p>返回<em> </em><code>words[i]</code> 是元音字符串的数目，其中<em> </em><code>i</code> 在闭区间 <code>[left, right]</code> 内。</p>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>示例 1：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>words = [\"are\",\"amy\",\"u\"], left = 0, right = 2\n",
    "<strong>输出：</strong>2\n",
    "<strong>解释：</strong>\n",
    "- \"are\" 是一个元音字符串，因为它以 'a' 开头并以 'e' 结尾。\n",
    "- \"amy\" 不是元音字符串，因为它没有以元音字母结尾。\n",
    "- \"u\" 是一个元音字符串，因为它以 'u' 开头并以 'u' 结尾。\n",
    "在上述范围中的元音字符串数目为 2 。\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 2：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>words = [\"hey\",\"aeo\",\"mu\",\"ooo\",\"artro\"], left = 1, right = 4\n",
    "<strong>输出：</strong>3\n",
    "<strong>解释：</strong>\n",
    "- \"aeo\" 是一个元音字符串，因为它以 'a' 开头并以 'o' 结尾。\n",
    "- \"mu\" 不是元音字符串，因为它没有以元音字母开头。\n",
    "- \"ooo\" 是一个元音字符串，因为它以 'o' 开头并以 'o' 结尾。\n",
    "- \"artro\" 是一个元音字符串，因为它以 'a' 开头并以 'o' 结尾。\n",
    "在上述范围中的元音字符串数目为 3 。\n",
    "</pre>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>提示：</strong></p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>1 &lt;= words.length &lt;= 1000</code></li>\n",
    "\t<li><code>1 &lt;= words[i].length &lt;= 10</code></li>\n",
    "\t<li><code>words[i]</code> 仅由小写英文字母组成</li>\n",
    "\t<li><code>0 &lt;= left &lt;= right &lt; words.length</code></li>\n",
    "</ul>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [count-the-number-of-vowel-strings-in-range](https://leetcode.cn/problems/count-the-number-of-vowel-strings-in-range/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [count-the-number-of-vowel-strings-in-range](https://leetcode.cn/problems/count-the-number-of-vowel-strings-in-range/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['[\"are\",\"amy\",\"u\"]\\n0\\n2', '[\"hey\",\"aeo\",\"mu\",\"ooo\",\"artro\"]\\n1\\n4']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        ans = 0\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in 'aeiou' and words[i][-1] in 'aeiou':\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        count = 0\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in \"aeiou\" and words [i][-1] in \"aeiou\":\n",
    "                count = count+1\n",
    "        return count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        ret = 0\n",
    "        a = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n",
    "\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in a and words[i][-1] in a:\n",
    "                ret = ret+1\n",
    "        \n",
    "        return ret\n",
    "        \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return len([x for x in words[left:right + 1] if x[0] in {'a','e','i','o','u'} and x[-1] in {'a','e','i','o','u'}])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        ans=0\n",
    "        dic={'a','e','i','o','u'}\n",
    "        for i in range(left,right+1):\n",
    "            # n=len(words[i])\n",
    "            if words[i][0] in dic and words[i][-1] in dic:\n",
    "                    ans+=1\n",
    "            # continue\n",
    "        return ans\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = set(\"aeiou\")\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        # vowels = {'a', 'e', 'i', 'o', 'u'}\n",
    "        vowels = ['a', 'e', 'i', 'o', 'u']\n",
    "        # return sum(words[i][0] in vowels and words[i][- 1] in vowels for i in range(left, right + 1))\n",
    "        return sum(word[0] in vowels and word[-1] in vowels for word in words[left: right + 1])\n",
    "        # result = 0\n",
    "        # for i in range(left,right+1):\n",
    "        #     if words[i][0] in vowels and words[i][-1] in vowels:\n",
    "        #         result += 1\n",
    "        # return result\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        res = 0\n",
    "        yuanyin = set('aeiou')\n",
    "        for word in words[left:right+1]:\n",
    "            if word[0] in yuanyin and word[-1] in yuanyin:\n",
    "                res += 1\n",
    "\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        ret=0\n",
    "        for i in range(left,right+1):\n",
    "            w=words[i]\n",
    "            if w[0] in [\"a\",\"e\",\"i\",\"o\",\"u\"] and w[-1] in [\"a\",\"e\",\"i\",\"o\",\"u\"]:\n",
    "                ret+=1\n",
    "        return ret"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = set(\"aeiou\")\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        count=0\n",
    "        lst=['a','e','i','o','u']\n",
    "        for i in words[left:right+1]:\n",
    "            if i[0] in lst and i[len(i)-1] in lst:\n",
    "                count+=1\n",
    "        return count\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "vowels = {'a', 'e', 'i', 'o', 'u'}\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(1 for word in words[left: right + 1] if len(word) > 0 and word[0] in vowels and word[-1] in vowels)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        yuanyin = ['a', 'e', 'i', 'o', 'u']\n",
    "        i = left\n",
    "        res = 0\n",
    "        while i <= right:\n",
    "            word = words[i]\n",
    "            if word[0] in yuanyin and word[-1] in yuanyin:\n",
    "                res += 1\n",
    "            i += 1\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        count = 0\n",
    "        vowel_list = set('aeiou')\n",
    "        for i in range(left, right+1):\n",
    "            if words[i][0] in vowel_list and words[i][-1] in vowel_list:\n",
    "                count+=1\n",
    "        return count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        count = 0\n",
    "        aeiou = ['a','e','i','o','u']\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in aeiou and words[i][-1] in aeiou:\n",
    "                count += 1\n",
    "        return count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(word[0] in 'aeiou' and word[-1] in 'aeiou' for word in words[left:right + 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        group = ['a', 'e', 'i', 'o', 'u']\n",
    "        res = 0\n",
    "        for i in range(left, right+1):\n",
    "            if words[i][0] in group and words[i][-1] in group:\n",
    "                res += 1\n",
    "        return res\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        alpha = set('aeiou')\n",
    "\n",
    "        ans = 0\n",
    "        for i in range(left, right+1):\n",
    "            if words[i][-1] in alpha and words[i][0] in alpha:\n",
    "                ans += 1\n",
    "        \n",
    "        return ans\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    vowel_letters = {\"a\", \"e\", \"i\", \"o\", \"u\"}\n",
    "\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        res = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if self.vowelString(word):\n",
    "                res += 1\n",
    "        return res\n",
    "\n",
    "    def vowelString(self, word: str) -> bool: \n",
    "        return word[0] in self.vowel_letters and word[len(word) - 1] in self.vowel_letters"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "vowels = {'a', 'e', 'i', 'o', 'u'}\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(1 for word in words[left: right + 1] if len(word) > 0 and word[0] in vowels and word[-1] in vowels)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = set(\"aeiou\")\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "  def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "    ans = 0\n",
    "    words = words[left: right+1]\n",
    "    for w in words:\n",
    "      if w[0] in 'aieou' and w[-1] in 'aieou':\n",
    "        ans+=1\n",
    "    return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        s1 = 'aeiou'\n",
    "        ans = 0\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in s1 and words[i][-1] in s1:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if word[0] in \"aeiou\" and word[-1] in \"aeiou\":\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        ans = 0\n",
    "        s = 'aeiou'\n",
    "        for i in range(left, right + 1):\n",
    "            x = words[i]\n",
    "            if x[0] in s and x[-1] in s:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = set(\"aeiou\")\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        words = words[left:right+1]\n",
    "        ans = 0\n",
    "        origin = ['a','e','i','o','u']\n",
    "        for word in words:\n",
    "            if word[0] in origin and word[-1] in origin:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        res=0\n",
    "        d=[\"a\",\"e\",\"i\",\"o\",\"u\"]\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in d and words[i][-1] in d:\n",
    "                res+=1\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        aeiou = 'aeiou'\n",
    "        result = 0\n",
    "        for word in words[left:right+1]:\n",
    "            if word[0] in aeiou and word[-1] in aeiou:\n",
    "                result += 1\n",
    "        return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        d = defaultdict(int)\n",
    "        d['a'] = 1\n",
    "        d['e'] = 1\n",
    "        d['i'] = 1\n",
    "        d['o'] = 1\n",
    "        d['u'] = 1\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            ans += d[words[i][0]] & d[words[i][-1]]\n",
    "        return ans\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        s1 = set('aeiou')\n",
    "        ans = 0\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in s1 and words[i][-1] in s1:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        nums = 0\n",
    "        for i in range(max(0,left),min(len(words),right+1)):\n",
    "            j = len(words[i])\n",
    "            if str(words[i][0]) in 'aeiou' and str(words[i][j-1]) in 'aeiou' :\n",
    "                nums+=1\n",
    "        return nums"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        check = ['a', 'e', 'i', 'o', 'u']\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            if words[i][0] in check and words[i][-1] in check:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        List=['a','e','i','o','u']\n",
    "        an=0\n",
    "        for i in words[left:right+1]:\n",
    "            if(i[0] in List and i[-1] in List):\n",
    "                an+=1\n",
    "        return an"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        yy = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n",
    "        out = 0\n",
    "        for i in words[left:right+1]:\n",
    "            if i[0] in yy and i[-1] in yy:\n",
    "                out += 1\n",
    "        return out"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            if words[i][0] in \"aeiou\" and words[i][-1] in \"aeiou\":\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        s = 'aeiou'\n",
    "        count = 0 \n",
    "\n",
    "        for index in range(left, right+1):\n",
    "            word  = words[index]\n",
    "\n",
    "            left,right = word[0],word[-1]\n",
    "\n",
    "            if left in s and right in s:\n",
    "                count+=1\n",
    "\n",
    "        return count\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(s[0] in \"aeiou\" and s[-1] in \"aeiou\" for s in words[left:right+1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        hashtable=['a','e','i','o','u']\n",
    "        count=0\n",
    "        for i in range(left,right+1):\n",
    "            lenth=len(words[i])\n",
    "            if words[i][0] in hashtable and words[i][lenth-1] in hashtable:\n",
    "                count+=1\n",
    "        return count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        res = 0\n",
    "        yuan_list = ['a', 'e', 'i', 'o', 'u']\n",
    "        new_list = words[left:right+1]\n",
    "        for each_word in new_list:\n",
    "            if each_word[0] in yuan_list and each_word[-1] in yuan_list:\n",
    "                res += 1\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowel = \"aeiou\"\n",
    "        vowel_num = 0\n",
    "        for i in words[left:right+1]:\n",
    "            if i[0] in vowel and i[len(i)-1] in vowel:\n",
    "                vowel_num += 1\n",
    "        return vowel_num"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = (\"a\", \"e\", \"i\", \"o\", \"u\")\n",
    "        ret = 0\n",
    "        for i in range(left, right+1):\n",
    "            if words[i][0] in vowels and words[i][-1] in vowels:\n",
    "                ret += 1\n",
    "        return ret\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        st = {'a', 'e', 'i', 'o','u'}\n",
    "        res = 0\n",
    "        for word in words[left:right+1]:\n",
    "            if word[0] in st and word[-1] in st:\n",
    "                res += 1\n",
    "        return res\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        s = 0\n",
    "        for i in words[left:right+1]:\n",
    "            if (i[0] == 'a' or i[0] == 'e' or i[0] == 'i' or i[0] == 'o' or i[0] == 'u') and (i[-1] == 'a' or i[-1] == 'e' or i[-1] == 'i' or i[-1] == 'o' or i[-1] == 'u'):\n",
    "                s += 1\n",
    "        return s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowel = ['a','e','i','o','u']\n",
    "        ans = 0\n",
    "        # words2 = words[left:right+1]\n",
    "        for word in words[left:right+1]:\n",
    "            if word[0] in vowel and word[-1] in vowel:\n",
    "                ans += 1\n",
    "        return ans \n",
    "        # return sum(1 for word in vowel if (word[0] in vowel and word[-1] in vowel))\n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = set(\"aeiou\")\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = [0] * 128\n",
    "        vowels[ord('a')] = 1\n",
    "        vowels[ord('e')] = 1\n",
    "        vowels[ord('i')] = 1\n",
    "        vowels[ord('o')] = 1\n",
    "        vowels[ord('u')] = 1\n",
    "        return sum(vowels[ord(w[0])] and vowels[ord(w[-1])] for w in words[left: right + 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        yuanyin = set(['a','e','i','o','u'])\n",
    "        res = 0\n",
    "        for i in range(left, right+1):\n",
    "            word = words[i]\n",
    "            if word[0] in yuanyin and word[-1] in yuanyin:\n",
    "                res += 1\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, s: List[str], l: int, r: int) -> int:\n",
    "        return sum(1 for x in range(l, r + 1) if s[x][0] in \"aeiou\" and s[x][-1] in \"aeiou\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = set(\"aeiou\")\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                ans += 1\n",
    "        return ans\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum((words[i][0] in \"aeiou\" and words[i][-1] in \"aeiou\" for i in range(left, right + 1)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = set(\"aeiou\")\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(\n",
    "            w[0] in 'aeiou' and w[-1] in 'aeiou' for w in words[left:right+1]       \n",
    "            )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        v=0\n",
    "        for i in range(left,right+1):\n",
    "\n",
    "            if words[i][0] in ['a','e','i','o','u'] and words[i][-1] in ['a','e','i','o','u']:\n",
    "                v+=1\n",
    "\n",
    "\n",
    "        return v\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:     \n",
    "        vowels=set(\"aeiou\")\n",
    "        ans=0\n",
    "        for i in range(left,right+1):\n",
    "            word=words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                ans+=1\n",
    "        return ans\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(all(c in \"aeiou\" for c in (s[0], s[-1])) for s in words[left: right + 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "         return sum(s[0] in \"aeiou\" and s[-1] in \"aeiou\" for s in words[left:right+1])\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = set(\"aeiou\")\n",
    "        ans = 0\n",
    "        for i in range(left, right + 1):\n",
    "            word = words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        count = 0\n",
    "        word = 'aeiou'\n",
    "        for i in range(left,right+1):\n",
    "            if (words[i][0] in word) and (words[i][-1] in word):\n",
    "                count+=1\n",
    "        return count\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        ans = 0\n",
    "        is_valid = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n",
    "        for i, word in enumerate(words):\n",
    "            if word[0] in is_valid and word[-1] in is_valid and (i >= left and i <= right):\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "\n",
    "        newList = words[left: right + 1]\n",
    "\n",
    "        result = 0\n",
    "        temp = ['a', 'e', 'i', 'o', 'u']\n",
    "        for i in newList:\n",
    "            if i[0] in temp and i[-1] in temp:\n",
    "                result += 1\n",
    "        \n",
    "        return result\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        res = 0\n",
    "        for i in range(left,right+1):\n",
    "            word = words[i]\n",
    "            if word[0] in 'aeiou' and word[-1] in 'aeiou':\n",
    "                res+=1\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(1 for i in range(left, right + 1) if words[i][0] in \"aeiou\" and words[i][-1] in \"aeiou\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(1 for word in words[left:right + 1] if word[0] in \"aeiou\" and word[-1] in \"aeiou\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        answer = 0\n",
    "\n",
    "        while left <= right:\n",
    "            if words[left].startswith(('a','e','i','o','u')):\n",
    "                if words[left].endswith(('a','e','i','o','u')):\n",
    "                    answer += 1\n",
    "\n",
    "            left += 1\n",
    "        \n",
    "        return answer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        listNew = []\n",
    "        listYuanyin = ['a','e','i','o','u']\n",
    "        count = 0\n",
    "        for i in range(right-left+1):\n",
    "            listNew.append(words[left+i])\n",
    "        for i in range(len(listNew)):\n",
    "            strTemp = str(listNew[i])\n",
    "            if strTemp[0] in listYuanyin and strTemp[-1] in listYuanyin:\n",
    "                count += 1\n",
    "        return count\n",
    "        \n",
    "\n",
    "\n",
    "        \n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        count = 0\n",
    "        y = ['a','e','i','o','u']\n",
    "        for word in words[left:right+1]:\n",
    "            if word[0] in y and word[-1] in y:\n",
    "                count += 1\n",
    "        return count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "vowels = {'a','e','i','o','u'}\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return len([None for w in words[left:right+1] if w[0] in vowels and w[-1] in vowels])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        target = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n",
    "        num=0\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in target and words[i][-1] in target:\n",
    "                num += 1\n",
    "        return num"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        s='aeiou'\n",
    "        ans=0\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in s and words[i][-1] in s:\n",
    "                ans+=1\n",
    "        return ans\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "vowels = [0] * 128\n",
    "vowels[ord('a')] = 1\n",
    "vowels[ord('e')] = 1\n",
    "vowels[ord('i')] = 1\n",
    "vowels[ord('o')] = 1\n",
    "vowels[ord('u')] = 1\n",
    "\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(vowels[ord(w[0])] and vowels[ord(w[-1])] for w in words[left: right + 1])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        count = 0\n",
    "        aut = {'a','o','e','i','u'}\n",
    "        for i in range(left,right + 1):\n",
    "            if words[i][0] in aut and words[i][-1] in aut:\n",
    "                count += 1\n",
    "        return count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        return sum(1 for i in range(left, right + 1) if words[i][0] in \"aeiou\" and words[i][-1] in \"aeiou\")\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        count = 0\n",
    "        vowel_list = ['a','e','i','o','u']\n",
    "        for word in words[left:right+1]:\n",
    "            if word[0] in vowel_list and word[-1] in vowel_list:\n",
    "                count+=1\n",
    "        return count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        yyin='aeiou'\n",
    "        sum=0\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in yyin and words[i][-1] in yyin:\n",
    "                sum =sum+1\n",
    "        return sum"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        \n",
    "        ans = 0\n",
    "        vowel_set = set(['a', 'e', 'i', 'o', 'u'])\n",
    "\n",
    "        for i in range(left, right + 1):\n",
    "            if words[i][0] in vowel_set and words[i][-1] in vowel_set:\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        res = 0\n",
    "        st = set('aeiou')\n",
    "        for i in range(left, right + 1):\n",
    "            if words[i][0] in st and words[i][-1] in st:\n",
    "                res += 1\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        ans = 0\n",
    "        for i in range(left,right+1):\n",
    "            if words[i][0] in 'aeiou' and words[i][-1] in 'aeiou':\n",
    "                ans += 1\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "        vowels = \"aeiou\"\n",
    "        return sum([\n",
    "            1 if word[0] in vowels and word[-1] in vowels else 0\n",
    "            for word in words[left : right + 1]\n",
    "        ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n",
    "\n",
    "        vowels = ['a', 'e', 'i', 'o', 'u']\n",
    "        count = 0\n",
    "    \n",
    "        for i in range(left, right+1):\n",
    "            word = words[i]\n",
    "            if word[0] in vowels and word[-1] in vowels:\n",
    "                count += 1\n",
    "    \n",
    "        return count\n",
    "\n"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
